<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/1/22
 * Time: 17:48
 */

class paypostorder extends CI_Controller{

        function __construct() {
            parent::__construct();
            //加载维修订单模型
            $this->load->model('order_model');
            $this->load->model('product_model');
        }

    /**
     * 添加苹果屏购买退货单产生的维修单接口
     */
    public function addpayorder(){
        $gp=gp();
        if($gp) {
            $maintain_id = $this->order_model->createRepairId($gp['repair_point']);
            $gp['maintain_id']=$maintain_id;
            $gp['repair_site_id']=$gp['repair_point'];
            $productlist=$gp['productlist'];
            unset($gp['repair_point']);
            unset($gp['productlist']);
            $this->order_model->addOrSetOrder($gp);
            //生成订单轨迹
            $trackData = array(
                'maintain_id' => $maintain_id, 'add_time' => date('Y-m-d H:i:s'),
                'target_status' => 1, 'modified_user' => 'admin',
            );
            $this->order_model->set_order_track('', $trackData);
            $productlist['maintain_id']=$maintain_id;
            $this->product_model->addOrSetProduct($productlist);
        }
    }
}